package com.sx.pipeline.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.noober.background.view.BLTextView
import com.sx.pipeline.R
import com.sx.pipeline.repos.http.res.BankListVO
import com.sx.pipeline.utils.AndroidUtil

/**
 * @Author：YY
 * @Date：2022/2/10
 * @Describe: 银行卡列表适配器
 */
class BankListAdapter(dataList: MutableList<BankListVO>) : BaseQuickAdapter<BankListVO, BaseViewHolder>(
    R.layout.item_bank_list, dataList) {
    /**
     * 删除银行卡
     */
    var deleteBankCallback: ((Int) -> Unit)? = null
    override fun convert(holder: BaseViewHolder, item: BankListVO) {
        holder.setText(R.id.tv_bank_name,item.bank)
        holder.setText(R.id.tv_bank_code,AndroidUtil.hideCardNo(item.bankAccount))
        holder.getView<BLTextView>(R.id.tv_delete).setOnClickListener {
            deleteBankCallback?.invoke(item.id)
        }
    }
}